<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

<head>
  <meta charset="UTF-8" />
  <title>会员列表-WeAdmin Frame型后台管理系统-WeAdmin 1.0</title>
  <meta name="renderer" content="webkit" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  <link rel="stylesheet" href="../../../static/css/font.css" />
  <link rel="stylesheet" href="../../../static/css/weadmin.css" />
  <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.5.1.min.js"></script>
  <script>
    $.get({
      url: "/member/list",
      success: function (data) {
        $("#memberList").html(data)
      }
    })
  </script>
</head>

<body>
  <div class="weadmin-nav">
    <span class="layui-breadcrumb">
      <a href="javascript:;">首页</a> <a href="javascript:;">会员管理</a>
      <a href="javascript:;"> <cite>会员列表</cite></a>
    </span>
    <a class="layui-btn layui-btn-sm" style="margin-top:3px;float:right"
      href="javascript:location.replace(location.href);" title="刷新">
      <i class="layui-icon layui-icon-refresh"></i>
    </a>
  </div>

  <div class="weadmin-body">
    <div class="layui-row">
      <form class="layui-form layui-col-md12 we-search">
        会员搜索：
        <div class="layui-inline">
          <input class="layui-input start" placeholder="开始日" autocomplete="off" name="start" id="start" />
        </div>
        <div class="layui-inline">
          <input class="layui-input end" placeholder="截止日" autocomplete="off" name="end" id="end" />
        </div>
        <div class="layui-inline">
          <input type="text" name="username" placeholder="请输入用户名" autocomplete="off" class="layui-input username" />
        </div>
        <button class="layui-btn search-btn" lay-submit="" lay-filter="search">
          <i class="layui-icon layui-icon-search"></i>
        </button>
      </form>
    </div>
    <div class="weadmin-block">
      <button class="layui-btn layui-btn-danger" onclick="delAll()">
        <i class="layui-icon layui-icon-delete"></i>批量删除
      </button>
      <button class="layui-btn" onclick="WeAdminShow('添加用户','./add.html',600,400)">
        <i class="layui-icon layui-icon-add-circle-fine"></i>添加
      </button>
      <span class="fr" style="line-height:40px">共有数据：<span>[[${session.memberNum}]]</span> 条</span>
    </div>
    <table class="layui-table" id="memberList" th:fragment="memberList">
      <thead>
        <tr>
          <th>
            <div class="layui-unselect header layui-form-checkbox" lay-skin="primary">
              <i class="layui-icon layui-icon-ok"></i>
            </div>
          </th>
          <th>ID</th>
          <th>用户名</th>
          <th>性别</th>
          <th>手机</th>
          <th>邮箱</th>
          <th>地址</th>
          <th>加入时间</th>
          <th>状态</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody  th:each="customer : ${session.customers}">
        <tr th:data-id="${customer.customerId}">
          <td>
            <div class="layui-unselect layui-form-checkbox" lay-skin="primary" th:data-id="${customer.customerId}">
              <i class="layui-icon layui-icon-ok"></i>
            </div>
          </td>
          <td>[[${customer.customerId}]]</td>
          <td>[[${customer.customerName}]]</td>
          <td>[[${customer.sex}]]</td>
          <td>[[${customer.customerPhone}]]</td>
          <td>[[${customer.customerEmail}]]</td>
          <td>[[${customer.customerAddress}]]</td>
          <td>[[${customer.joinTime}]]</td>
          <td class="td-status">
            <span th:if="${customer.customerStatus}==1" class="layui-btn layui-btn-normal layui-btn-xs">已启用</span>
            <span th:if="${customer.customerStatus}==0" class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled">已停用</span>
          </td>
          <td class="td-manage">
            <a th:if="${customer.customerStatus}==1" onclick="member_stop(this,'10001')" href="javascript:;" title="启用">
              <i class="layui-icon layui-icon-download-circle"></i>
            </a>
            <a th:if="${customer.customerStatus}==0" onclick="member_stop(this,'10001')" href="javascript:;" title="停用">
              <i class="layui-icon layui-icon-upload-circle"></i>
            </a>
            <a title="编辑" onclick="WeAdminEdit('编辑','./edit.html', this, 600, 400)" href="javascript:;">
              <i class="layui-icon layui-icon-edit"></i>
            </a>
            <a title="删除" onclick="member_del(this)" href="javascript:;">
              <i class="layui-icon layui-icon-delete"></i>
            </a>
          </td>
        </tr>
      </tbody>
    </table>
    <div class="page">
      <div class="list" th:fragment="page">
        <span class="num" th:each="page:${session.pages}" th:uuid="${page}">[[${page}]]</span>
      </div>
    </div>
  </div>
  <script src="../../../static/lib/layui/layui.js" type="text/javascript"></script>
  <script src="../../../static/js/eleDel.js" type="text/javascript"></script>

<!--  查找用户-->
  <script>
    layui.use(['form', 'layer', "jquery"], function () {
      var form = layui.form,
              layer = layui.layer,
              $ = layui.jquery;

      //监听提交
      form.on('submit(search)', function (data) {
        var f = data.field;
        var username = f.username;
        var start = f.start;
        var end = f.end;
        if(username!="" || start!="" || end!="") {
          var find_data = {start: start,end: end, username: username}
          $.post({
            url: "/member/find",
            contentType: "application/json;charset=UTF-8",
            data: JSON.stringify(find_data),
            success: function (data) {
              $("#memberList").html(data)
              $(".num[uuid=1]").addClass("current")
              $(".num[uuid=1]").siblings().removeClass("current")
            }
          })
        }
        return false;
      });
    });
  </script>


<!--  换页-->
  <script>
    $(".num[uuid=1]").addClass("current")
    $(".num").click(function () {
      var page = $(this).attr("uuid")
      $.post({
        url: "/member/page/"+page,
        contentType: "application/json;charset=UTF-8",
        success: function (data) {
          $("#memberList").html(data)
        },
        async: false
      })
      $(this).addClass("current")
      $(this).siblings().removeClass("current")
    })
  </script>
</body>

</html>